<template>
  <j-modal
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    :title="title"
    :visible="visible"
    :width="width"
    cancelText="关闭"
    switchFullscreen
    @cancel="handleCancel"
    @ok="handleOk">
    <a-form-item>
      <j-date v-model="sjrq" class="query-group-cust" placeholder="请选择日期"></j-date>
    </a-form-item>
  </j-modal>
</template>

<script>

import { getAction } from '@/api/manage'

export default {
  name: 'SjrqRefressModal',
  components: {},
  data() {
    return {
      model: {},
      sjrq: undefined,
      title: '选择日期',
      width: 600,
      visible: false,
      disableSubmit: false
    }
  },
  props: {
    handleAdd: {
      type: Function,
      default: null
    }
  },
  methods: {
    showModal() {
      this.sjrq = undefined
      //this.params  = params;
      this.visible = true
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk(e) {
      if (this.sjrq == undefined || this.sjrq == '') {
        this.$message.warning('请选择数据日期!')
        return
      }
      let that = this
      this.$confirm({
        title: '确认刷新',
        content: '是否刷新' + this.sjrq+'的数据?',
        onOk: function() {
          that.visible = false
          that.$parent.$parent.loading = true
          getAction('/reportInfo/llbbDepositLl/refreshData', {
            'sjrq': that.sjrq
          }).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.$parent.$parent.loading = false
              that.$parent.$parent.loadData(1)
            } else {
              that.$parent.$parent.loading = false
              that.$message.warning(res.message)
            }
          })
        }
      })
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.sjrq = ''
      this.close()
    }
  }
}
</script>